package com.yss.datamiddle.vo.baseinfomaintain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yss.datamiddle.entity.ErrorScoreEntity;
import com.yss.datamiddle.po.baseinfomaintain.TErrorScorePo;
import com.yss.datamiddle.po.baseinfomaintain.TScoreLevelPo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.Optional;

import lombok.Data;
import org.springframework.beans.BeanUtils;


/**
 * @description: 数据评分管理
 * @create: 2020/07/10 13:22
 * @update: 2020/07/10 13:22
 */
@ApiModel(value = "质量评分管理Vo")
@Data
public class ScoreLevelVo {
    /**
     * 主键id
     */
    @ApiModelProperty(value = "主键id")
    private Integer id;

    /**
     * 结束分数值
     */
    @ApiModelProperty(value = "起始分-结束分")
    private String scoreStartAndScoreEnd;

    /**
     * 级别数值
     */
    @ApiModelProperty(value = "级别数值")
    private String levelCode;

    /**
     * 级别名称
     */
    @ApiModelProperty(value = "级别名称")
    private String levelName;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;



    public static ScoreLevelVo po2vo(TScoreLevelPo po){
        ScoreLevelVo vo = new ScoreLevelVo();
        BeanUtils.copyProperties(po, vo);
        StringBuffer sb = new StringBuffer();
        sb.append
                (Optional.ofNullable(po.getScoreStart().toString()).orElse(""));
        sb.append("-");
        sb.append
                (Optional.ofNullable(po.getScoreEnd().toString()).orElse(""));
        vo.setScoreStartAndScoreEnd(sb.toString());
        return vo;
    }
}

